﻿using CemsTransfer.BUS;
using CemsTransfer.Event;

namespace CemsTransfer.Service
{
    public class SerialProcess
    {
        public SerialProcess()
        {
            CemsDataProcess dataProcess = new CemsDataProcess();
            string portname = AppSettingsHelper.Configuration["PortName"];
            int baudRate = Convert.ToInt32(AppSettingsHelper.Configuration["BaudRate"]);
            int parity = Convert.ToInt32(AppSettingsHelper.Configuration["Parity"]);
            int databits = Convert.ToInt32(AppSettingsHelper.Configuration["DataBits"]);
            int stopbits = Convert.ToInt32(AppSettingsHelper.Configuration["StopBits"]);
            dataProcess.OpenSerialPort(portname,baudRate,parity,databits,stopbits);
            dataProcess.InitAllDeviceCmd();
            //dataProcess.CmdSend();
            dataProcess.TcpServerConnect();
            dataProcess.Check485();
        }

    }
}
